package com.kly.chatter.api.application.controller.user.res;

import com.kly.user.dto.ModelDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@ApiModel(description = "model 返回参数")
public class ModelRes {

    @ApiModelProperty(value = "用户编号")
    private String userCode;

    @ApiModelProperty(value = "融云token")
    private String token;

    @ApiModelProperty(value = "用户昵称")
    private String nickName;

    @ApiModelProperty(value = "头像地址")
    private String avatarUrl;

    @ApiModelProperty(value = "出生年月")
    private Date birthday;

    @ApiModelProperty(value = "年龄")
    private Integer age;

    @ApiModelProperty(value = "是否加入黑名单 0否 1是")
    private int haveBlack;


    public static List<ModelRes> toModelRes(List<ModelDto> modelDtoList) {
        List<ModelRes> modelResList = new ArrayList<>();
        for (ModelDto modelDto : modelDtoList) {
            ModelRes modelRes = new ModelRes();
            modelRes.setUserCode(modelDto.getUserCode());
            modelRes.setToken(modelDto.getToken());
            modelRes.setNickName(modelDto.getNickName());
            modelRes.setAvatarUrl(modelDto.getAvatarUrl());
            modelRes.setAge(modelDto.getAge());
            modelRes.setBirthday(modelDto.getBirthday());
            modelRes.setHaveBlack(modelDto.getHaveBlack());
            modelResList.add(modelRes);
        }
        return modelResList;
    }
}
